# Contributor: <xmingske@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
_pkgname=chardet
pkgname=py3-$_pkgname
pkgver=4.0.0
pkgrel=3
pkgdesc="The Universal Character Encoding Detector"
url="https://github.com/chardet/chardet/"
arch="noarch"
license="LGPL-2.1-or-later"
depends="python3"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-chardet" # Backwards compatibility
provides="py-chardet=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	python3 -m pytest
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
}

sha512sums="ebd7f420e1094445270db993f6373ffe7370419e002b0bb13299dc6c9b0f7c4e77b0f44f871fba6371e6869e7c86728514367db377e3137487a3acf50cb81e96  chardet-4.0.0.tar.gz"
